import org.apache.spark.SparkContext
import org.apache.spark.sql.SparkSession

/**
  * @ Auther: o2o-rd-0008
  * @ Date:   2019/9/3 12:37
  * @ Param:  ${PARAM}
  * @ Description: 
  */
object ccc {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession.builder()
      .appName(s"${this.getClass.getSimpleName}")
      .config("spark.debug.maxToStringFields", "2000")
      .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
      .config("es.nodes", "192.168.1.29")
      .config("es.port", "9200")
      .config("cluster.name","O2OElastic")
      .config("es.net.http.auth.user", "elastic")
      .config("es.net.http.auth.pass", "changeme")
      .master("local[*]")
      .getOrCreate()

    val sc: SparkContext = spark.sparkContext
    sc.setLogLevel("WARN")
    sc.hadoopConfiguration.set("fs.s3a.access.key", "GAO7EO9FWKPJ8WFCQDME")
    sc.hadoopConfiguration.set("fs.s3a.secret.key", "LZ0xaHBSYKHaJ9ECDbX9f7zin79UZkXfGoNapRPL")
    sc.hadoopConfiguration.set("fs.s3a.endpoint", "https://obs.cn-north-1.myhuaweicloud.com")

//    spark.read.json("s3a://o2o-dimension-table/address_table/address_table_2021/1/address_platform/tmall_address_2021_1/").where("shopId='472817141'").show(100,false)

    spark.read.json("s3a://o2o-dimension-table/address_table/address_table_2021/2/address_platform/icbc_address_2021_2/").printSchema()


    //    spark.read.json("s3a://o2o-dimension-table/address_table/address_table_2020/12/address_platform/tmall_address_2020_12/")
//      .where("shopId='452775482'").show(1000)

//    spark.read.json("s3a://o2o-dimension-table/address_table/address_table_2021/1/address_platform/tmall_address_2021_1/").where("shopId='452775482'").show()
      /*.registerTempTable("tab")

    spark.sql(
      """
        |select
        |*
        |from
        |tab
        |where
      """.stripMargin)

    */sc.stop()

  }


}






